package com.somsoft.handjc.activity.tongji;

import android.content.Intent;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.GridView;
import android.widget.Toast;

import com.somsoft.handjc.activity.BaseGridViewActivity;
import com.somsoft.handjc.activity.R;
import com.somsoft.handjc.activity.query.QueryActivity;
import com.somsoft.handjc.activity.query.xuncha.ZhongHeQueryActivity;
import com.somsoft.handjc.activity.tongji.xuncha.XunChaTongJiMainActivity;
import com.somsoft.handjc.activity.tongji.xzsp.XzspTongJiMainActivity;
import com.somsoft.handjc.activity.tongji.xzzf.XzzfTongJiMain;
import com.somsoft.handjc.util.MyApplication;
import com.somsoft.handjc.util.Utils;

@SuppressWarnings("all")
public class TongJiActivity extends BaseGridViewActivity {
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		MyApplication.getInstance().addActivity(this);
		setContentView(R.layout.gridview);
		GridView gridview = (GridView) findViewById(R.id.gridview);
		Integer[] pics = {R.drawable.e1, R.drawable.e2, R.drawable.e3, R.drawable.e4,R.drawable.e5 };
		String[] titles = {"效能巡查统计","行政执法统计","行政审批统计","公共资源统计","重大项目统计"};
		super.createGridView(gridview,pics,titles);
	}

	@Override
	public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
		boolean flag = false;
		Intent it = null;
		switch (arg2) {
		case 0:
			flag = Utils.isPass(Utils.USER_LEVEL, XunChaTongJiMainActivity.class);
			if(flag){
				it = new Intent(TongJiActivity.this,XunChaTongJiMainActivity.class);
			}else{
				Toast t = Toast.makeText(this, "对不起！你无权访问该模块！", Toast.LENGTH_SHORT);
				t.setGravity(Gravity.CENTER, 0, 0);
				t.show();
			}
			break;
		case 1:
			flag = Utils.isPass(Utils.USER_LEVEL, XzzfTongJiMain.class);
			if(flag){
				it = new Intent(TongJiActivity.this,XzzfTongJiMain.class);
			}else{
				Toast t = Toast.makeText(this, "对不起！你无权访问该模块！", Toast.LENGTH_SHORT);
				t.setGravity(Gravity.CENTER, 0, 0);
				t.show();
			}
			break;
		case 2:
			flag = Utils.isPass(Utils.USER_LEVEL, XzspTongJiMainActivity.class);
			if(flag){
				it = new Intent(TongJiActivity.this,XzspTongJiMainActivity.class);
			}else{
				Toast t = Toast.makeText(this, "对不起！你无权访问该模块！", Toast.LENGTH_SHORT);
				t.setGravity(Gravity.CENTER, 0, 0);
				t.show();
			}
			break;
		default:
			Toast t = Toast.makeText(this, "该功能开发中！", Toast.LENGTH_SHORT);
			t.setGravity(Gravity.CENTER, 0, 0);
			t.show();
			break;
		}
		if(it != null){
			startActivity(it);
		}
	}
}